<html>
<head>
<title>main</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="{{$css_dir}}/admin.css" />
</head>
<style>
.item {
	float:left;
	width:100px;
	
}
</style>
<script type="text/javascript">
window.onload = function() {
	var roles = '{{$roles}}';
	var myRoles = roles.split(',');
	var checkboxs = document.getElementById('allroles').getElementsByTagName('input');
	var i, j, g, flag;
	if (myRoles.length > 0)
		for (i = 0,j = checkboxs.length;i < j;i++) {
			flag = 0;
			for (g = 0;g < myRoles.length;g++)
				if (checkboxs[i].value == myRoles[g]) {
					flag = 1;
					break;
				}
			if (flag == 1)
				checkboxs[i].checked = 'checked';
		}
}
</script>
<body>
<br>
<table width=98% align=center cellspacing=1 cellpadding=3 class=i_table>
<tr><td class=head>
管　理　员　管　理——权 限 管 理</td></tr>
<tr><td class=b>
<form action="{{url controller=$ctlName action=adminRole}}" method="post">
	<div style="border:solid 2px blue;padding:3px;">管理员{{$admin.username}}的权限：</div>
	<div style="padding:10px;width:99%;height:99%;" id="allroles">
		{{foreach from=$allroles item=role}}
		<div class="item"><input type="checkbox" name="roles[]" value="{{$role.role_id}}" />{{$role.rolename}}</div>
		{{/foreach}}
	</div>
	<div style="clear:both;"><input type="submit" name="s" value="修改"></div>
</form>
</td>
</tr></table>
<br>
</body></html>